
*********************************************************************
* Do Personality Traits Predict Voter Attitudes When Politics Is 	*
* Structured Around Conflict? Lessons From Israel					*
*                                                                   *
* Rivlin-Angert, Yakter, and Sheffer								*
* Public Opinion Quarterly											*
*                                                                   *
* Replication code - regression models and robustness tests        	* *********************************************************************
* The analysis was performed with Stata 17. For model presentation, *
* users should install the estout package_group						* 
* (command line: "ssc install estout, replace").					*
* 																	*
* to load the data (the "use" command), users should place the .dta	*
* file in their Stata working directory (or type the full file 		*
* paths as saved on their computer).                      			*
*********************************************************************

*************
* load data *
*************
use "Angert-Rivlin, Yakter, Sheffer POQ - main survey data" , clear

*******************************
* regression models (Table 3) *
*******************************
eststo clear 
foreach var in z1social z1economic z1conflict z1orientation {
	dis "`var'"
	qui eststo: reg `var' agree consc stabi extra openn
	qui eststo: reg `var' agree consc stabi extra openn gender age_group educ i.religion 
	}
esttab, ///
	b(3) r2(3) p(3) ///
	nostar ///
	drop (1*) ///
	coeflabels(consc "Conscientiousness" openn "Openness" agree "Agreeableness" ///
		stabi "Stability" extra "Extraversion" gender "Female" age_group "Age Group" ///
		educ "Education" 2.religion "Religiosity: Traditional" ///
		3.religion "Religiosity: Religious" 4.religion "Religiosity: Ultra-Orthodox" ///
		_cons "Constant") ///
	mgroups("Social" "Economic" "Conflict" "Left-Right", pattern(1 0 1 0 1 0 1 0) ///
		prefix(\multicolumn{@span}{c}{) suffix(})   ///
        span erepeat(\cmidrule(lr){@span}))         ///
	addnotes("P-values in parentheses. The reference category for religiosity is Secular. The analysis is unweighted and uses listwise deletion of missing values.") ///
	nogaps compress nomtitles nonotes
	* (to procude the table in Latex code, add "tex" in the options)
	
********************
* robustness tests *
********************
** the relationship between religion and big five
* 1. demonstrating that personality traits are similar across religious groups
	* (obtaning mean and sd scores, which would then be plotted in R - Figure E1)
foreach iv of varlist agree consc stabi extra openn {
	dis "****************"
	dis "trait: `iv'" 
	dis "****************"
	sum `iv'
	sum `iv' if religion==1
	sum `iv' if religion==2
	sum `iv' if religion==3
	sum `iv' if religion==4
}
* 2. testing for a possible heterogenous effects across religious groups
	* (obtaning model coefficients, which would then be plotted in R - Figure E2)
 foreach var in z1social z1economic z1conflict z1orientation {
	dis "***************************"
	dis "Dependent variabe:  `var'"
	dis "***************************"
	dis "full sample"
	dis "***********"
	reg `var' agree consc stabi extra openn gender age_group educ i.religion
	foreach r of numlist 1/4 {
		dis "Religiosity: " `r'
		dis "****************"
			reg `var' agree consc stabi extra openn gender age_group educ if religion==`r'
			}
	}
	
** models for older respondents only (30 or above), when personality is more formed and stabler (Table E1)
eststo clear 
foreach var in z1social z1economic z1conflict z1orientation {
	qui eststo: reg `var' agree consc stabi extra openn gender age_group educ i.religion
	qui eststo: reg `var' agree consc stabi extra openn gender age_group educ i.religion if age_group!=1
	}
esttab, ///
	b(3) r2(3) p(3) ///
	nostar ///
	drop (1*) ///
	coeflabels(consc "Conscientiousness" openn "Openness" agree "Agreeableness" ///
		stabi "Stability" extra "Extraversion" gender "Female" age_group "Age Group" ///
		educ "Education" 2.religion "Religiosity: Traditional" ///
		3.religion "Religiosity: Religious" 4.religion "Religiosity: Ultra-Orthodox" ///
		_cons "Constant") ///
	mtitles("Full" "30+" "Full" "30+" "Full" "30+" "Full" "30+") ///
	mgroups("Social" "Economic" "Conflict" "Left-Right", pattern(1 0 1 0 1 0 1 0) ///
		prefix(\multicolumn{@span}{c}{) suffix(})   ///
        span erepeat(\cmidrule(lr){@span}))         ///
		addnotes("P-values in parentheses. The reference category for religiosity is Secular. The analysis is unweighted and uses listwise deletion of missing values.") ///
	nogaps compress nonotes
	* (to procude the table in Latex code, add "tex" in the options)

